---
title: 
  | 
  | Replication Material
  | 
  | Do Voters Want Domestic Politicians to Scrutinize the European Union? 
  |
  | doi: -- tba --
author: "Roman Senninger and Daniel Bischof"
date: "Contact: rsenninger@ps.au.dk"
output: 
  bookdown::html_document2:
    theme: cosmo
    highlight: kate
    toc: true
    number_sections: false
    toc_float: 
     collapsed: true
     smooth_scroll: true
    code_folding: hide
---

```{r setup, include = F}
knitr::opts_knit$set(root.dir = '/Users/au506709/Dropbox/RomanDaniel/Roman lead/MPs_Voters_and_EU_Oversight/data/replication_files/data/')
```

# Data 

This manual provides code to reproduce the results in the main body of the paper and the supplementary materials. Please visit the PSRM dataverse (https://dataverse.harvard.edu/dataverse/PSRM) or Roman's Dataverse (https://dataverse.harvard.edu/dataverse/R_Senninger) to download the data used in this manual.   

# Load Required Packages

```{r, eval = T, echo = T, include= T, message= FALSE, fig.height = 5, fig.width = 5, fig.align = "center"}

library("cjoint")
library("cregg")
library("ggplot2")
library("ggthemes")
library("firatheme")



```

# Session Info
```{r, eval = T, echo = T, include= T, message= FALSE, fig.height = 5, fig.width = 5, fig.align = "center"}

sessionInfo()
```


# Figure 1

```{r, eval = T, echo = T, include=TRUE, fig.width= 3, fig.height= 3, fig.align = "center", out.width="25%"}

# load dataset 
load("./dataframe1.RData")

# left panel

plot(eurlex$YEAR, eurlex$directives, type = "h", ylim = c(0, 200), xlab="", ylab="", las = 1, lwd = 1)
title(main = "Directives", font=1, adj = 0)


# right panel

plot(aggeushare$year, aggeushare$eushare, type = "o", pch = 19,  ylim = c(0, 0.4), xlab="", ylab="", las = 1, lty = 1, lwd = 1)
title(main = "Plenary Statements", font=1, adj = 0)


```

# Figure 2

```{r, eval = T, echo = T, include=TRUE, fig.width= 8, fig.height= 8, fig.align = "center", out.width="45%"}

# load dataset 
load("./dataframe2.RData")

amce <- cjoint::amce(selected ~  `mp_knowledge` +  `mp_missday` + `mp_reform` + `mp_experience` + `mp_sex` + `mp_party` + `mp_motivation`, 
                     cjointdata, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE, 
                     na.ignore= FALSE,
                     weights = NULL, 
                     baselines = baselines)

# get amce summary data and create dataframe to make figures  

data <- summary(amce)
data1 <- data$amce
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value")
data1 <- data1[myvars]
data2 <- data$baselines_amce
data2$Estimate <- NA
data2$`Std. Err` <- NA
data2$`z value` <- NA

plotdata <- rbind(data1, data2)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0
plotdata$plotorder = factor(plotdata$Attribute, 
                     levels=c("mp_knowledge", "mp_experience",
                              "mp_sex", "mp_missday","mp_party", 
                              "mp_motivation", "mp_reform"), 
                     labels = c("knowledge", "experience", "sex", 
                                "absent days", "party", "motivation", 
                                "Eurozone reform"))

# subset left panel attributes

plotdata1 <- subset(plotdata, plotorder == "knowledge" | 
                             plotorder == "absent days" | 
                             plotorder == "Eurozone reform")

plotdata1$attribute[plotdata1$plotorder == "knowledge"] <- "most knowledge about"
plotdata1$attribute[plotdata1$plotorder == "absent days"] <- "absent mostly because of"
plotdata1$attribute[plotdata1$plotorder == "Eurozone reform"] <- "effort to reform the Eurozone"

plotdata1$order[plotdata1$Level == "constituency"] <- 1
plotdata1$order[plotdata1$Level == "little"] <- 2
plotdata1$order[plotdata1$Level == "much"] <- 3
plotdata1$order[plotdata1$Level == "none"] <- 1
plotdata1$order[plotdata1$Level == "national politics"] <- 2
plotdata1$order[plotdata1$Level == "European politics"] <- 3
plotdata1$order[plotdata1$Level == "meetings in Berlin"] <- 2
plotdata1$order[plotdata1$Level == "meetings at the EU-level"] <- 3
plotdata1$order[plotdata1$Level == "meetings in the constituency"] <- 1


attribute <- c(`knowledge` = "most knowledge about", `absent days` = "absent mostly because of", `Eurozone reform` = "effort to reform the Eurozone")

plotdata1$baseline <- "0"
plotdata1$baseline[plotdata1$Level == "constituency"] <- "1"
plotdata1$baseline[plotdata1$Level == "meetings in the constituency"] <- "1"
plotdata1$baseline[plotdata1$Level == "none"] <- "1"


ggplot() +   
  geom_hline(yintercept = 0, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata1, aes(x = reorder(Level, -order), color = baseline, y = Estimate, ymin = lower, ymax = upper), alpha = 0.7, size=1.2, fatten = 1.2) + 
  coord_flip() + scale_y_continuous(limits = c(-0.15, 0.2), breaks=c(-0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., labeller = as_labeller(attribute), scales = "free_y",  ncol = 1) +
  theme_fira() +
  scale_colour_manual(values = c("gray30", "gray80")) +
  xlab("") + ylab("Effect on probability that candidate is chosen")  + theme(legend.position = "none") + theme(axis.text.y = element_text(size=14, color = "black"), axis.text.x = element_text(size=14, color = "black"), strip.text = element_text(size = 14, color = "black"))


# subset right panel attributes

plotdata2 <- subset(plotdata, plotorder == "experience" | plotorder == "motivation" | plotorder == "party" | plotorder == "sex")

plotdata2$attribute[plotdata2$plotorder == "experience"] <- "experience in parliament"
plotdata2$attribute[plotdata2$plotorder == "motivation"] <- "motivation to run"
plotdata2$attribute[plotdata2$plotorder == "party"] <- "party"
plotdata2$attribute[plotdata2$plotorder == "sex"] <- "sex"

plotdata2$order[plotdata2$Level == "two years"] <- 1
plotdata2$order[plotdata2$Level == "six years"] <- 2
plotdata2$order[plotdata2$Level == "ten years"] <- 3
plotdata2$order[plotdata2$Level == "forteen years"] <- 4
plotdata2$order[plotdata2$Level == "male"] <- 1
plotdata2$order[plotdata2$Level == "female"] <- 2
plotdata2$order[plotdata2$Level == "AfD"] <- 1
plotdata2$order[plotdata2$Level == "Die Linke"] <- 2
plotdata2$order[plotdata2$Level == "CDU/CSU"] <- 3
plotdata2$order[plotdata2$Level == "FDP"] <- 4
plotdata2$order[plotdata2$Level == "SPD"] <- 5
plotdata2$order[plotdata2$Level == "B90/Gruene"] <- 6
plotdata2$order[plotdata2$Level == "to serve the party"] <- 1
plotdata2$order[plotdata2$Level == "to impact personally"] <- 2
plotdata2$order[plotdata2$Level == "to represent ordinary people"] <- 3


attribute <- c(`experience` = "experience in parliament", `motivation` = "motivation to run", `party` = "party", `sex` = "sex")

plotdata2$baseline <- "0"
plotdata2$baseline[plotdata2$Level == "two years"] <- "1"
plotdata2$baseline[plotdata2$Level == "male"] <- "1"
plotdata2$baseline[plotdata2$Level == "AfD"] <- "1"
plotdata2$baseline[plotdata2$Level == "to serve the party"] <- "1"

ggplot() +   
  geom_hline(yintercept = 0, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata2,
                  aes(x = reorder(Level, -order), color = baseline, y = Estimate, ymin = lower, ymax = upper), alpha = 0.7, size=1.2, fatten = 2.1, shape = 17) + 
  coord_flip() + scale_y_continuous(limits = c(-0.1, 0.4), breaks=c(-0.1, 0, 0.1, 0.2, 0.3, 0.4)) +
  facet_wrap(plotorder ~ ., labeller = as_labeller(attribute), scales = "free_y",  ncol = 1) +
  theme_fira() +
  scale_colour_manual(values = c("gray30", "gray80")) +
  xlab("") + ylab("Effect on probability that candidate is chosen")  + theme(legend.position = "none") + theme(axis.text.y = element_text(size=14, color = "black"), axis.text.x = element_text(size=14, color = "black"), strip.text = element_text(size = 14, color = "black"))

```


# Figure 3

```{r, eval = T, echo = T, include=TRUE, fig.width= 8, fig.height= 8, fig.align = "center", out.width="45%", warning = FALSE}

# load dataset 
load("./dataframe3.RData")

amce2 <- cjoint::amce(selected ~  EUsupport:`mp_knowledge` +  EUsupport:`mp_missday` + EUsupport:`mp_reform`,cjointdata_EUsupport, 
                      design = MPdesign,
                      subset = NULL,
                      respondent.id = "respondent", 
                      cluster = TRUE,  
                      weights = NULL, 
                      baselines = baselines,
                      na.ignore = FALSE,
                      respondent.varying = "EUsupport")

# get amce summary data and create dataframe to make figures  

data <- summary(amce2)

data1 <- data[["EUsupport1amce"]]
data1$eu <- "negative"
data2 <- data[["EUsupport2amce"]]
data2$eu <- "neither nor"
data3 <- data[["EUsupport3amce"]]
data3$eu <- "positive"
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "eu")
data1 <- data1[myvars]
data2 <- data2[myvars]
data3 <- data3[myvars]
data4 <- data$baselines_amce
data4$Estimate <- NA
data4$`Std. Err` <- NA
data4$`z value` <- NA
data4$eu <- "positive"

plotdata <- rbind(data1, data2, data3, data4)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, 
                            levels=c("mp_knowledge", "mp_missday", "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata <- subset(plotdata, plotorder == "knowledge" | plotorder == "absent days" | plotorder == "Eurozone reform")

plotdata$attribute[plotdata$plotorder == "knowledge"] <- "most knowledge about"
plotdata$attribute[plotdata$plotorder == "absent days"] <- "absent mostly because of"
plotdata$attribute[plotdata$plotorder == "Eurozone reform"] <- "effort to reform the Eurozone"

plotdata$order[plotdata$Level == "constituency"] <- 1
plotdata$order[plotdata$Level == "little"] <- 2
plotdata$order[plotdata$Level == "much"] <- 3
plotdata$order[plotdata$Level == "none"] <- 1
plotdata$order[plotdata$Level == "national politics"] <- 2
plotdata$order[plotdata$Level == "European politics"] <- 3
plotdata$order[plotdata$Level == "meetings in Berlin"] <- 2
plotdata$order[plotdata$Level == "meetings at the EU-level"] <- 3
plotdata$order[plotdata$Level == "meetings in the constituency"] <- 1


attribute <- c(`knowledge` = "most knowledge about", `absent days` = "absent mostly because of", `Eurozone reform` = "effort to reform the Eurozone")

plotdata$baseline <- "0"
plotdata$baseline[plotdata$Level == "constituency"] <- "1"
plotdata$baseline[plotdata$Level == "meetings in the constituency"] <- "1"
plotdata$baseline[plotdata$Level == "none"] <- "1"
plotdata$eu[plotdata$baseline == "1"] <- "baseline"

ggplot() + 
  geom_hline(yintercept = 0, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata, aes(x = reorder(Level, -order), y = Estimate, ymin = lower, ymax = upper, color = eu),  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.15, 0.2), breaks=c(-0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  facet_wrap(plotorder ~ ., labeller = as_labeller(attribute), scales = "free_y",  ncol = 1) +
  theme_fira() +
  scale_colour_manual(values = c("gray90", "gray70", "gray50", "black"), labels = c("", "negative", "neither nor", "positive")) +
  xlab("") + ylab("Effect on probability that candidate is chosen")  +  theme(axis.text.y = element_text(size=14, color = "black"), axis.text.x = element_text(size=14, color = "black"), strip.text = element_text(size = 14, color = "black")) + 
  theme(legend.title=element_blank(), legend.position = "right") +
  guides(colour=guide_legend(override.aes=list(alpha= c(0, 1, 1, 1))))


# marginal means

mm_by1 <- cj(cjointdata_EUsupport, selected ~ mp_knowledge + mp_missday + mp_reform, id = ~respondent, estimate = "mm", by = ~EUsupport)

plotdata <- mm_by1
plotdata[is.na(plotdata)] <- 0
plotdata$plotorder = factor(plotdata$feature, levels=c("mp_knowledge", "mp_experience",
                                                       "mp_sex", "mp_missday",
                                                       "mp_party", "mp_motivation",
                                                       "mp_reform"), 
                            labels = c("knowledge", "experience", "sex", "absent days", "party", "motivation", "Eurozone reform"))

plotdata$attribute[plotdata$plotorder == "knowledge"] <- "most knowledge about"
plotdata$attribute[plotdata$plotorder == "absent days"] <- "absent mostly because of"
plotdata$attribute[plotdata$plotorder == "Eurozone reform"] <- "effort to reform the Eurozone"

attribute <- c(`knowledge` = "most knowledge about", `absent days` = "absent mostly because of", `Eurozone reform` = "effort to reform the Eurozone")

plotdata$order <- 0
plotdata$order[plotdata$level == "constituency"] <- 1
plotdata$order[plotdata$level == "European politics"] <- 2
plotdata$order[plotdata$level == "national politics"] <- 3
plotdata$order[plotdata$level == "meetings in Berlin"] <- 4
plotdata$order[plotdata$level == "meetings at the EU-level"] <- 5
plotdata$order[plotdata$level == "meetings in the constituency"] <- 6
plotdata$order[plotdata$level == "none"] <- 7
plotdata$order[plotdata$level == "little"] <- 8
plotdata$order[plotdata$level == "much"] <- 9

ggplot() + 
  geom_hline(yintercept = 0.5, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(level, -order), y = estimate, ymin = lower, ymax = upper, color = EUsupport), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(0.35, 0.65), breaks=c(0.4,0.5, 0.6)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  facet_wrap(plotorder ~ ., labeller = as_labeller(attribute), scales = "free_y",  ncol = 1) +
  theme_fira() +
  scale_colour_manual(values = c( "gray70", "gray50", "black"), labels = c("negative", "neither nor", "positive")) +
  xlab("") + ylab("Marginal Means")  +  theme(axis.text.y = element_text(size=14, color = "black"), axis.text.x = element_text(size=14, color = "black"), strip.text = element_text(size = 14, color = "black")) + 
  theme(legend.title=element_blank(), legend.position = "right") 

```


# Supplementary Materials


## Figure S1-S2


```{r, eval = T, echo = T, include=TRUE, fig.width= 12, fig.height= 8, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe4.RData")


amce <- cjoint::amce(selected ~  `mp_knowledge` +  `mp_missday` + `mp_reform` + `mp_experience` + `mp_sex` + `mp_party` + `mp_motivation`, 
                     cjointdata, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE, 
                     na.ignore= FALSE,
                     weights = "weights1", 
                     baselines = baselines)

data <- summary(amce)
data1 <- data$amce
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value")
data1 <- data1[myvars]
data2 <- data$baselines_amce
data2$Estimate <- NA
data2$`Std. Err` <- NA
data2$`z value` <- NA


plotdata <- rbind(data1, data2)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0
plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_experience",
                                                         "mp_sex", "mp_missday",
                                                         "mp_party", "mp_motivation",
                                                         "mp_reform"), 
                            labels = c("knowledge", "experience", "sex", 
                                       "absent days", "party", "motivation", "Eurozone reform"))


plotdata$eu[plotdata$Attribute == "mp_knowledge"] <- 1
plotdata$eu[plotdata$Attribute == "mp_missday"] <- 1
plotdata$eu[plotdata$Attribute == "mp_reform"] <- 1
plotdata$eu[is.na(plotdata$eu)] <- 0


ggplot() + geom_rect(data = subset(plotdata, eu == 1), xmin = -Inf, xmax = Inf,
                     ymin = -Inf, ymax = Inf, fill = "lightgray", alpha = 0.1) + 
  geom_hline(yintercept = 0, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -Estimate), y = Estimate, ymin = lower, ymax = upper), size=0.7, color="gray40", fatten = 0.5) + 
  coord_flip() + scale_y_continuous(limits = c(-0.2, 0.5), breaks=c(0, 0.2, 0.4)) +
  facet_wrap(plotorder ~ ., scales = "free_y",  ncol = 3) + 
  theme_bw() + xlab("") + ylab("")  + theme(legend.position = "none") + theme(axis.text.y = element_text(size=14, color = "black"), axis.text.x = element_text(size=14, color = "black"), strip.text = element_text(size = 14, color = "black"))



amce <- cjoint::amce(selected ~  `mp_knowledge` +  `mp_missday` + `mp_reform` + `mp_experience` + `mp_sex` + `mp_party` + `mp_motivation`, 
                     cjointdata, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE, 
                     na.ignore= FALSE,
                     weights = "weights2", 
                     baselines = baselines)

data <-summary(amce)
data1 <- data$amce
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value")
data1 <- data1[myvars]
data2 <- data$baselines_amce
data2$Estimate <- NA
data2$`Std. Err` <- NA
data2$`z value` <- NA


plotdata <- rbind(data1, data2)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0
plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_experience",
                                                         "mp_sex", "mp_missday",
                                                         "mp_party", "mp_motivation",
                                                         "mp_reform"), 
                            labels = c("knowledge", "experience", "sex", 
                                       "absent days", "party", "motivation", "Eurozone reform"))


plotdata$eu[plotdata$Attribute == "mp_knowledge"] <- 1
plotdata$eu[plotdata$Attribute == "mp_missday"] <- 1
plotdata$eu[plotdata$Attribute == "mp_reform"] <- 1
plotdata$eu[is.na(plotdata$eu)] <- 0


ggplot() + geom_rect(data = subset(plotdata, eu == 1), xmin = -Inf, xmax = Inf,
                     ymin = -Inf, ymax = Inf, fill = "lightgray", alpha = 0.1) + 
  geom_hline(yintercept = 0, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -Estimate), y = Estimate, ymin = lower, ymax = upper), size=0.7, color="gray40", fatten = 0.5) + 
  coord_flip() + scale_y_continuous(limits = c(-0.2, 0.5), breaks=c(0, 0.2, 0.4)) +
  facet_wrap(plotorder ~ ., scales = "free_y",  ncol = 3) + 
  theme_bw() + xlab("") + ylab("")  + theme(legend.position = "none") + theme(axis.text.y = element_text(size=14, color = "black"), axis.text.x = element_text(size=14, color = "black"), strip.text = element_text(size = 14, color = "black"))

```


## Figure S3-S4

```{r, eval = T, echo = T, include=TRUE, fig.width= 12, fig.height= 8, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe5.RData")

amce <- cjoint::amce(selected ~  `mp_knowledge` +  `mp_missday` + `mp_reform` + `mp_experience` + `mp_sex` + `mp_party` + `mp_motivation`, 
                     cjointdata, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE, 
                     na.ignore= FALSE,
                     weights = "weights1", 
                     baselines = baselines)

data <-summary(amce)
data1 <- data$amce
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value")
data1 <- data1[myvars]
data2 <- data$baselines_amce
data2$Estimate <- NA
data2$`Std. Err` <- NA
data2$`z value` <- NA

plotdata <- rbind(data1, data2)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0
plotdata$plotorder = factor(plotdata$Attribute, 
                            levels=c("mp_knowledge", "mp_experience",
                                     "mp_sex", "mp_missday",
                                    "mp_party", "mp_motivation", "mp_reform"), 
                            labels = c("knowledge", "experience", "sex", 
                                       "absent days", "party", "motivation", "Eurozone reform"))


plotdata$eu[plotdata$Attribute == "mp_knowledge"] <- 1
plotdata$eu[plotdata$Attribute == "mp_missday"] <- 1
plotdata$eu[plotdata$Attribute == "mp_reform"] <- 1
plotdata$eu[is.na(plotdata$eu)] <- 0


ggplot() + geom_rect(data = subset(plotdata, eu == 1), xmin = -Inf, xmax = Inf,
                     ymin = -Inf, ymax = Inf, fill = "lightgray", alpha = 0.1) + 
  geom_hline(yintercept = 0, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -Estimate), y = Estimate, ymin = lower, ymax = upper), size=0.7, color="gray40", fatten = 0.5) + 
  coord_flip() + scale_y_continuous(limits = c(-0.2, 0.5), breaks=c(0, 0.2, 0.4)) +
  facet_wrap(plotorder ~ ., scales = "free_y",  ncol = 3) + 
  theme_bw() + xlab("") + ylab("")  + theme(legend.position = "none") + theme(axis.text.y = element_text(size=14, color = "black"), axis.text.x = element_text(size=14, color = "black"), strip.text = element_text(size = 14, color = "black"))



amce <- cjoint::amce(selected ~  `mp_knowledge` +  `mp_missday` + `mp_reform` + `mp_experience` + `mp_sex` + `mp_party` + `mp_motivation`, 
                     cjointdata, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE, 
                     na.ignore= FALSE,
                     weights = "weights2", 
                     baselines = baselines)

data <-summary(amce)
data1 <- data$amce
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value")
data1 <- data1[myvars]
data2 <- data$baselines_amce
data2$Estimate <- NA
data2$`Std. Err` <- NA
data2$`z value` <- NA

plotdata <- rbind(data1, data2)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0
plotdata$plotorder = factor(plotdata$Attribute, 
                            levels=c("mp_knowledge", "mp_experience","mp_sex", "mp_missday",
                                     "mp_party", "mp_motivation", "mp_reform"), 
                            labels = c("knowledge", "experience", "sex", 
                                       "absent days", "party", "motivation", "Eurozone reform"))


plotdata$eu[plotdata$Attribute == "mp_knowledge"] <- 1
plotdata$eu[plotdata$Attribute == "mp_missday"] <- 1
plotdata$eu[plotdata$Attribute == "mp_reform"] <- 1
plotdata$eu[is.na(plotdata$eu)] <- 0


ggplot() + geom_rect(data = subset(plotdata, eu == 1), xmin = -Inf, xmax = Inf,
                     ymin = -Inf, ymax = Inf, fill = "lightgray", alpha = 0.1) + 
  geom_hline(yintercept = 0, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -Estimate), y = Estimate, ymin = lower, ymax = upper), size=0.7, color="gray40", fatten = 0.5) + 
  coord_flip() + scale_y_continuous(limits = c(-0.2, 0.5), breaks=c(0, 0.2, 0.4)) +
  facet_wrap(plotorder ~ ., scales = "free_y",  ncol = 3) + 
  theme_bw() + xlab("") + ylab("")  + theme(legend.position = "none") + theme(axis.text.y = element_text(size=14, color = "black"), axis.text.x = element_text(size=14, color = "black"), strip.text = element_text(size = 14, color = "black"))

```

## Figure S5-S7


```{r, eval = T, echo = T, include=TRUE, fig.width= 8, fig.height= 8, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe6.RData")

amce4 <- cjoint::amce(selected ~  agegroup:`mp_knowledge` +  agegroup:`mp_missday` + agegroup:`mp_reform`, 
                      cjointdata, 
                      design = MPdesign,
                      subset = NULL,
                      respondent.id = "respondent", 
                      cluster = TRUE,  
                      weights = NULL, 
                      baselines = baselines,
                      na.ignore = FALSE,
                      respondent.varying = "agegroup")

facet.levels1 <- list()
facet.levels1[["agegroup"]] <- c("A", "B", "C", "D", "E", "F")
plot(amce4, xlab = "", facet.names = "agegroup", facet.levels = facet.levels1)

```

```{r, eval = T, echo = T, include=TRUE, fig.width= 8, fig.height= 4, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe6.RData")
baselines$mp_missday <- "meetings in Berlin"

amce1 <- cjoint::amce(selected ~  gender:`mp_knowledge` +  gender:`mp_missday` + gender:`mp_reform`, 
                      cjointdata, 
                      design = MPdesign,
                      subset = NULL,
                      respondent.id = "respondent", 
                      cluster = TRUE, 
                      weights = NULL, 
                      baselines = baselines,
                      na.ignore = FALSE,
                      respondent.varying = "gender")

facet.levels1 <- list()
facet.levels1[["gender"]] <- c("male","female")
plot(amce1, xlab = "", facet.names = "gender", facet.levels = facet.levels1)

```


```{r, eval = T, echo = T, include=TRUE, fig.width= 8, fig.height= 8, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe6.RData")
baselines$mp_missday <- "meetings in Berlin"

amce3 <- cjoint::amce(selected ~  schoolqual:`mp_knowledge` +  schoolqual:`mp_missday` + schoolqual:`mp_reform`, 
                      cjointdata, 
                      design = MPdesign,
                      subset = NULL,
                      respondent.id = "respondent", 
                      cluster = TRUE,  
                      weights = NULL, 
                      baselines = baselines,
                      na.ignore = FALSE,
                      respondent.varying = "schoolqual")

facet.levels1 <- list()
facet.levels1[["schoolqual"]] <- c("high school certificate","advanced technical certificate", "secondary school certificate", "primary school/lower secondary certificate")
plot(amce3, xlab = "", facet.names = "schoolqual", facet.levels = facet.levels1)

```


## Figure S8

```{r, eval = T, echo = T, include=TRUE, fig.width= 6, fig.height= 6, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe2.RData")
baselines$mp_missday <- "meetings in Berlin"

amce <- cjoint::amce(selected ~  voteintention:`mp_knowledge` +  voteintention:`mp_missday` + voteintention:`mp_reform`, 
                      cjointdata, 
                      design = MPdesign,
                      subset = NULL,
                      respondent.id = "respondent", 
                      cluster = TRUE,  
                      weights = NULL, 
                      baselines = baselines,
                      na.ignore = FALSE,
                      respondent.varying = "voteintention")

data <- summary(amce)

data1 <- data[["voteintention1amce"]]
data1$party <- "AfD"
data2 <- data[["voteintention2amce"]]
data2$party <- "Bündnis 90/Die Gruenen"
data3 <- data[["voteintention3amce"]]
data3$party <- "CDU/CSU"
data4 <- data[["voteintention4amce"]]
data4$party <- "Die Linke"
data6 <- data[["voteintention6amce"]]
data6$party <- "FDP"
data10 <- data[["voteintention10amce"]]
data10$party <- "SPD"

myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "party")
data1 <- data1[myvars]
data2 <- data2[myvars]
data3 <- data3[myvars]
data4 <- data4[myvars]
data6 <- data6[myvars]
data10 <- data10[myvars]

data9 <- data$baselines_amce
data9$Estimate <- NA
data9$`Std. Err` <- NA
data9$`z value` <- NA

# left panel

data9$party <- "AfD"

plotdata <- rbind(data1, data3, data10, data9)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata$number[plotdata$Level == "constituency" | plotdata$Level == "meetings in Berlin" |
                  plotdata$Level == "none"] <- 1 
plotdata$number[plotdata$Level == "European politics" | plotdata$Level == "meetings at the EU-level" |
                  plotdata$Level == "little"] <- 2 
plotdata$number[plotdata$Level == "national politics" | plotdata$Level == "meetings in the constituency" |
                  plotdata$Level == "much"] <- 3 


ggplot() + 
  geom_hline(yintercept = 0, color = "salmon") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -number), y = Estimate, ymin = lower, ymax = upper, color = party), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.25, 0.25), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50", "gray20")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 


# right panel
data9$party <- "Bündnis 90/Die Gruenen"

plotdata <- rbind(data2, data4, data6, data9)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata$number[plotdata$Level == "constituency" | plotdata$Level == "meetings in Berlin" |
                  plotdata$Level == "none"] <- 1 
plotdata$number[plotdata$Level == "European politics" | plotdata$Level == "meetings at the EU-level" |
                  plotdata$Level == "little"] <- 2 
plotdata$number[plotdata$Level == "national politics" | plotdata$Level == "meetings in the constituency" |
                  plotdata$Level == "much"] <- 3 


ggplot() + 
  geom_hline(yintercept = 0, color = "salmon") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -number), y = Estimate, ymin = lower, ymax = upper, color = party), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.25, 0.25), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50", "gray20")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 


```


## Figure S9

```{r, eval = T, echo = T, include=TRUE, fig.width= 6, fig.height= 6, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe2.RData")
baselines$mp_missday <- "meetings in Berlin"

#left panel

amce <- cjoint::amce(selected ~  opposition1:`mp_knowledge` +  opposition1:`mp_missday` + opposition1:`mp_reform`, 
                     cjointdata, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE,  
                     weights = NULL, 
                     baselines = baselines,
                     na.ignore = FALSE,
                     respondent.varying = "opposition1")

data <- summary(amce)

data1 <- data[["opposition11amce"]]
data1$party <- "opposition"
data2 <- data[["opposition12amce"]]
data2$party <- "government"
data3 <- data[["opposition13amce"]]
data3$party <- "other"

myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "party")
data1 <- data1[myvars]
data2 <- data2[myvars]
data3 <- data3[myvars]


data4 <- data$baselines_amce
data4$Estimate <- NA
data4$`Std. Err` <- NA
data4$`z value` <- NA
data4$party <- "opposition"

plotdata <- rbind(data1, data2, data4)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata$number[plotdata$Level == "constituency" | plotdata$Level == "meetings in Berlin" |
                  plotdata$Level == "none"] <- 1 
plotdata$number[plotdata$Level == "European politics" | plotdata$Level == "meetings at the EU-level" |
                  plotdata$Level == "little"] <- 2 
plotdata$number[plotdata$Level == "national politics" | plotdata$Level == "meetings in the constituency" |
                  plotdata$Level == "much"] <- 3 


ggplot() + 
  geom_hline(yintercept = 0, color = "salmon") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -number), y = Estimate, ymin = lower, ymax = upper, color = party), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.3, 0.3), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50", "gray20")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 

#right panel

amce <- cjoint::amce(selected ~  opposition2:`mp_knowledge` +  opposition2:`mp_missday` + opposition2:`mp_reform`, 
                     cjointdata, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE,  
                     weights = NULL, 
                     baselines = baselines,
                     na.ignore = FALSE,
                     respondent.varying = "opposition2")

data <- summary(amce)

data1 <- data[["opposition21amce"]]
data1$party <- "opposition"
data2 <- data[["opposition22amce"]]
data2$party <- "government"
data3 <- data[["opposition23amce"]]
data3$party <- "other"

myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "party")
data1 <- data1[myvars]
data2 <- data2[myvars]
data3 <- data3[myvars]


data4 <- data$baselines_amce
data4$Estimate <- NA
data4$`Std. Err` <- NA
data4$`z value` <- NA
data4$party <- "opposition"

plotdata <- rbind(data1, data2, data4)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata$number[plotdata$Level == "constituency" | plotdata$Level == "meetings in Berlin" |
                  plotdata$Level == "none"] <- 1 
plotdata$number[plotdata$Level == "European politics" | plotdata$Level == "meetings at the EU-level" |
                  plotdata$Level == "little"] <- 2 
plotdata$number[plotdata$Level == "national politics" | plotdata$Level == "meetings in the constituency" |
                  plotdata$Level == "much"] <- 3 


ggplot() + 
  geom_hline(yintercept = 0, color = "salmon") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -number), y = Estimate, ymin = lower, ymax = upper, color = party), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.3, 0.3), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50", "gray20")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 


```

## Figure S10

```{r, eval = T, echo = T, include=TRUE, fig.width= 6, fig.height= 6, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe2.RData")
baselines$mp_missday <- "meetings in Berlin"

amce <- cjoint::amce(selected ~  opposition3:`mp_knowledge` +  opposition3:`mp_missday` + opposition3:`mp_reform`, 
                     cjointdata, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE,  
                     weights = NULL, 
                     baselines = baselines,
                     na.ignore = FALSE,
                     respondent.varying = "opposition3")

data <- summary(amce)

data1 <- data[["opposition31amce"]]
data1$party <- "opposition"
data2 <- data[["opposition32amce"]]
data2$party <- "government"

myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "party")
data1 <- data1[myvars]
data2 <- data2[myvars]

data3 <- data$baselines_amce
data3$Estimate <- NA
data3$`Std. Err` <- NA
data3$`z value` <- NA
data3$party <- "opposition"

plotdata <- rbind(data1, data2, data3)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata$number[plotdata$Level == "constituency" | plotdata$Level == "meetings in Berlin" |
                  plotdata$Level == "none"] <- 1 
plotdata$number[plotdata$Level == "European politics" | plotdata$Level == "meetings at the EU-level" |
                  plotdata$Level == "little"] <- 2 
plotdata$number[plotdata$Level == "national politics" | plotdata$Level == "meetings in the constituency" |
                  plotdata$Level == "much"] <- 3 


ggplot() + 
  geom_hline(yintercept = 0, color = "salmon") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -number), y = Estimate, ymin = lower, ymax = upper, color = party), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.3, 0.3), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50", "gray20")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 

```

## Figure S11


```{r, eval = T, echo = T, include=TRUE, fig.width= 6, fig.height= 6, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe7.RData")
baselines$mp_missday <- "meetings in Berlin"

# left panel

amce <- cjoint::amce(selected ~  GERdemocracy:`mp_knowledge` +  GERdemocracy:`mp_missday` + GERdemocracy:`mp_reform`, 
                      cjointdata_GERdemocracy, 
                      design = MPdesign,
                      subset = NULL,
                      respondent.id = "respondent", 
                      cluster = TRUE,  
                      weights = NULL, 
                      baselines = baselines,
                      na.ignore = FALSE,
                      respondent.varying = "GERdemocracy")

data <- summary(amce)

data1 <- data[["GERdemocracy1amce"]]
data1$eu <- "dissatisfied"
data2 <- data[["GERdemocracy2amce"]]
data2$eu <- "satisfied"
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "eu")
data1 <- data1[myvars]
data2 <- data2[myvars]
data3 <- data$baselines_amce
data3$Estimate <- NA
data3$`Std. Err` <- NA
data3$`z value` <- NA
data3$eu <- "satisfied"

plotdata <- rbind(data1, data2, data3)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata$number[plotdata$Level == "constituency" | plotdata$Level == "meetings in Berlin" |
                  plotdata$Level == "none"] <- 1 
plotdata$number[plotdata$Level == "European politics" | plotdata$Level == "meetings at the EU-level" |
                  plotdata$Level == "little"] <- 2 
plotdata$number[plotdata$Level == "national politics" | plotdata$Level == "meetings in the constituency" |
                  plotdata$Level == "much"] <- 3 


ggplot() + 
  geom_hline(yintercept = 0, color = "salmon") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -number), y = Estimate, ymin = lower, ymax = upper, color = eu), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.2, 0.2), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 


# right panel

# load dataset 
load("./dataframe8.RData")
baselines$mp_missday <- "meetings in Berlin"

amce1 <- cjoint::amce(selected ~  EUdemocracy:`mp_knowledge` +  EUdemocracy:`mp_missday` + EUdemocracy:`mp_reform`, 
                     cjointdata_EUdemocracy, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE,  
                     weights = NULL, 
                     baselines = baselines,
                     na.ignore = FALSE,
                     respondent.varying = "EUdemocracy")

data <- summary(amce1)

data1 <- data[["EUdemocracy1amce"]]
data1$eu <- "dissatisfied"
data2 <- data[["EUdemocracy2amce"]]
data2$eu <- "satisfied"
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "eu")
data1 <- data1[myvars]
data2 <- data2[myvars]
data3 <- data$baselines_amce
data3$Estimate <- NA
data3$`Std. Err` <- NA
data3$`z value` <- NA
data3$eu <- "satisfied"

plotdata <- rbind(data1, data2, data3)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata$number[plotdata$Level == "constituency" | plotdata$Level == "meetings in Berlin" |
                  plotdata$Level == "none"] <- 1 
plotdata$number[plotdata$Level == "European politics" | plotdata$Level == "meetings at the EU-level" |
                  plotdata$Level == "little"] <- 2 
plotdata$number[plotdata$Level == "national politics" | plotdata$Level == "meetings in the constituency" |
                  plotdata$Level == "much"] <- 3 


ggplot() + 
  geom_hline(yintercept = 0, color = "salmon") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -number), y = Estimate, ymin = lower, ymax = upper, color = eu), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.2, 0.2), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 


```

## Figure S12


```{r, eval = T, echo = T, include=TRUE, fig.width= 6, fig.height= 6, fig.align = "center", out.width="55%", warning = FALSE}

#left panel

# load dataset 
load("./dataframe9.RData")

baselines$mp_missday <- "meetings in Berlin"

amce3 <- cjoint::amce(selected ~  impact:`mp_knowledge` +  impact:`mp_missday` + impact:`mp_reform`, 
                      cjointdata_impact, 
                      design = MPdesign,
                      subset = NULL,
                      respondent.id = "respondent", 
                      cluster = TRUE,  
                      weights = NULL, 
                      baselines = baselines,
                      na.ignore = FALSE,
                      respondent.varying = "impact")

data <- summary(amce3)

data1 <- data[["impact1amce"]]
data1$eu <- "disagree"
data2 <- data[["impact2amce"]]
data2$eu <- "agree"
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "eu")
data1 <- data1[myvars]
data2 <- data2[myvars]
data3 <- data$baselines_amce
data3$Estimate <- NA
data3$`Std. Err` <- NA
data3$`z value` <- NA
data3$eu <- "agree"

plotdata <- rbind(data1, data2, data3)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata$number[plotdata$Level == "constituency" | plotdata$Level == "meetings in Berlin" |
                  plotdata$Level == "none"] <- 1 
plotdata$number[plotdata$Level == "European politics" | plotdata$Level == "meetings at the EU-level" |
                  plotdata$Level == "little"] <- 2 
plotdata$number[plotdata$Level == "national politics" | plotdata$Level == "meetings in the constituency" |
                  plotdata$Level == "much"] <- 3 


ggplot() + 
  geom_hline(yintercept = 0, color = "salmon") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -number), y = Estimate, ymin = lower, ymax = upper, color = eu), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.2, 0.2), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 

# right panel 

# load dataset 
load("./dataframe10.RData")

baselines$mp_missday <- "meetings in Berlin"

amce4 <- cjoint::amce(selected ~  orientation:`mp_knowledge` +  orientation:`mp_missday` + orientation:`mp_reform`, 
                      cjointdata_orientation, 
                      design = MPdesign,
                      subset = NULL,
                      respondent.id = "respondent", 
                      cluster = TRUE,  
                      weights = NULL, 
                      baselines = baselines,
                      na.ignore = FALSE,
                      respondent.varying = "orientation")

data <- summary(amce4)

data1 <- data[["orientation1amce"]]
data1$eu <- "national"
data2 <- data[["orientation2amce"]]
data2$eu <- "European"
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "eu")
data1 <- data1[myvars]
data2 <- data2[myvars]
data3 <- data$baselines_amce
data3$Estimate <- NA
data3$`Std. Err` <- NA
data3$`z value` <- NA
data3$eu <- "European"

plotdata <- rbind(data1, data2, data3)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0

plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform"), 
                            labels = c("knowledge", "absent days", "Eurozone reform")) 

plotdata$number[plotdata$Level == "constituency" | plotdata$Level == "meetings in Berlin" |
                  plotdata$Level == "none"] <- 1 
plotdata$number[plotdata$Level == "European politics" | plotdata$Level == "meetings at the EU-level" |
                  plotdata$Level == "little"] <- 2 
plotdata$number[plotdata$Level == "national politics" | plotdata$Level == "meetings in the constituency" |
                  plotdata$Level == "much"] <- 3 


ggplot() + 
  geom_hline(yintercept = 0, color = "salmon") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -number), y = Estimate, ymin = lower, ymax = upper, color = eu), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.2, 0.2), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 

```


## Figure S14


```{r, eval = T, echo = T, include=TRUE, fig.width= 12, fig.height= 8, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe11.RData")

baselines$mp_missday <- "meetings in Berlin"

amce <- cjoint::amce(selected ~  `mp_knowledge` +  `mp_missday` + `mp_reform` + `mp_experience` + `mp_sex` + `mp_party` + `mp_motivation`, 
                     cjointdata_manipulcheck_pos, 
                     design = MPdesign,
                     subset = NULL,
                     respondent.id = "respondent", 
                     cluster = TRUE, 
                     na.ignore= FALSE,
                     weights = NULL, 
                     baselines = baselines)

data <-summary(amce)
data1 <- data$amce
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value")
data1 <- data1[myvars]
data2 <- data$baselines_amce
data2$Estimate <- NA
data2$`Std. Err` <- NA
data2$`z value` <- NA



plotdata <- rbind(data1, data2)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0
plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_experience",
                                                         "mp_sex", "mp_missday",
                                                         "mp_party", "mp_motivation",
                                                         "mp_reform"), 
                            labels = c("knowledge", "experience", "sex", 
                                       "absent days", "party", "motivation", "Eurozone reform"))


plotdata$eu[plotdata$Attribute == "mp_knowledge"] <- 1
plotdata$eu[plotdata$Attribute == "mp_missday"] <- 1
plotdata$eu[plotdata$Attribute == "mp_reform"] <- 1
plotdata$eu[is.na(plotdata$eu)] <- 0


ggplot() + geom_rect(data = subset(plotdata, eu == 1), xmin = -Inf,xmax = Inf,
                     ymin = -Inf,ymax = Inf, fill = "lightgray", alpha = 0.1) + 
  geom_hline(yintercept = 0, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -Estimate), y = Estimate, ymin = lower, ymax = upper), size=0.7, color="gray40", fatten = 0.5) + 
  coord_flip() + scale_y_continuous(limits = c(-0.2, 0.5), breaks=c(0, 0.2, 0.4)) +
  facet_wrap(plotorder ~ ., scales = "free_y",  ncol = 3) +
  theme_bw() + xlab("") + ylab("")  + theme(legend.position = "none") + theme(axis.text.y = element_text(size=14, color = "black"), axis.text.x = element_text(size=14, color = "black"), strip.text = element_text(size = 14, color = "black"))

```

## Figure S15

```{r, eval = T, echo = T, include=TRUE, fig.width= 8, fig.height= 10, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe12.RData")

baselines$mp_missday <- "meetings in Berlin"

amce <- cjoint::amce(selected ~  posttreat:`mp_knowledge` +  posttreat:`mp_missday` + 
                        posttreat:`mp_reform` + posttreat:`mp_experience` + 
                        posttreat:`mp_sex` + posttreat:`mp_party` + posttreat:`mp_motivation`, 
                      cjointrandomdata, 
                      design = MPdesign,
                      subset = NULL,
                      respondent.id = "respondent", 
                      cluster = TRUE,  
                      weights = NULL, 
                      baselines = baselines,
                      na.ignore = FALSE,
                      respondent.varying = "posttreat")

data <- summary(amce)


data1 <- data[["posttreat1amce"]]
data1$eu <- "pre-treatment"
data2 <- data[["posttreat2amce"]]
data2$eu <- "post-treatment"
myvars <- c("Attribute", "Level", "Estimate", "Std. Err", "z value", "eu")
data1 <- data1[myvars]
data2 <- data2[myvars]
data3 <- data$baselines_amce
data3$Estimate <- NA
data3$`Std. Err` <- NA
data3$`z value` <- NA
data3$eu <- "post-treatment"

plotdata <- rbind(data1, data2, data3)

plotdata$upper <- plotdata$Estimate + 1.96*plotdata$`Std. Err`
plotdata$lower <- plotdata$Estimate - 1.96*plotdata$`Std. Err`

plotdata[is.na(plotdata)] <- 0
plotdata$plotorder = factor(plotdata$Attribute, levels=c("mp_knowledge", "mp_missday",
                                                         "mp_reform", "mp_experience",
                                                         "mp_party", "mp_motivation",
                                                         "mp_sex"), 
                            labels = c("knowledge", "absent days", "Eurozone reform", 
                                       "experience", "party", "motivation", "sex"))

ggplot() + 
  geom_hline(yintercept = 0, linetype = 2, color = "gray70") +
  geom_pointrange(data=plotdata,
                  aes(x = reorder(Level, -Estimate), y = Estimate, ymin = lower, ymax = upper, color = eu), 
                  size=0.7, fatten = 0.5, position=position_dodge(width=0.8)) + 
  coord_flip() + scale_y_continuous(limits = c(-0.45, 0.45), breaks=c(-0.2, -0.1, 0, 0.1, 0.2)) +
  facet_wrap(plotorder ~ ., scales = "free_y", ncol = 1) +
  theme_bw() + xlab("") + ylab("") + scale_color_manual(values=c("gray80", "gray50")) +
  theme(legend.title=element_blank(), legend.position = "bottom") 

```

## Table S1 and S2
```{r, eval = T, echo = T, include=TRUE, fig.width= 12, fig.height= 8, fig.align = "center", out.width="55%", warning = FALSE}

# load dataset 
load("./dataframe13.RData")

# gender - Sample
prop.table(table(cjointdata$gender))
# gender - EES
prop.table(svytable(~gndr, design = ger_w)) 

# age groups - Sample
prop.table(table(cjointdata$agegroup)) 
# age groups - EES
prop.table(svytable(~agegroup, design = ger_w))

# school qualification - Sample
prop.table(table(cjointdata$schoolqual)) 
# school qualification - EES
prop.table(svytable(~edubde1, design = ger_w))

# EU attitudes - Sample
prop.table(table(cjointdata$EUsupport))
# EU attitudes - Eurobarometer
prop.table(table(eurobarometer$d78))


```

